import { http } from "@/utils/http/index";

export const userLogin = (data?: any) => {
  return http.request<any>("post", "/user/login", { data });
};

export const registerUser = (data?: any) => {
  return http.request<any>("post", "/user/register", { data });
};

export const verifyEmail = (params: { code?: string; id?: string }) => {
  return http.request<any>("get", "/user/verifyEmail", {
    params
  });
};

export const sendEmail = (params: { id?: string }) => {
  return http.request<any>("post", "/user/sendEmail", {
    params
  });
};

export const getUserAvatar = (params: { username?: string }) => {
  return http.request<any>("get", "/user/getUserAvatar", {
    params
  });
};

export const logout = () => {
  return http.request<any>("get", "/user/logout");
};

export const getUserInfo = (params?: object) => {
  return http.request<any>("get", "/user/getUserInfo", { params });
};

export const updateUserInfo = (data?: object) => {
  return http.request<any>("put", "/user/updateUserInfo", { data });
};

export const updatePassword = (data?: object) => {
  return http.request<any>("put", "/user/updatePassword", { data });
};
